package com.geek.thread.thread_pool;

import lombok.extern.slf4j.Slf4j;

/**一个简单的单例测试*/
@Slf4j
public class SimpleSingleton{

    private volatile static SimpleSingleton instance;

    private SimpleSingleton(){
//        log.info("---------初始化---------");
    }
    public void log(int i){
//        log.info("执行线程("+Thread.currentThread().getName()+")---"+ i + "---" + this);
    }

    public static void resetInstance(){
        instance = null;
    }

    public static SimpleSingleton getInstance(){
        if(instance == null){
            synchronized (SimpleSingleton.class){
                if(instance == null){
                    instance = new SimpleSingleton();
                }
            }
        }
        return instance;
    }
}
